#pragma once
#ifndef __CELL__H__
#define __CELL__H__

#include "type.h"
#include "candidate.h"

#pragma warning( disable : 4512 )

namespace ATSudokuEngine
{

static const UInt32 INVALID_VALUE = 0;

class Cell
{
public:
	Cell(UInt32 nIndex=0, UInt32 nValue=INVALID_VALUE) : nIndex_(nIndex), nValue_(nValue)
	{
	}

	bool operator == (UInt32 nIndex) const;
	bool operator == (const Cell& aCell) const;
	bool operator == (const Cell* pCell) const;
	operator UInt32() const;

	UInt32 Index() const;
	UInt32 Value() const;

	CandidateConstIterator BeginCandidates() const;
	CandidateConstIterator EndCandidates() const;
protected:
	void SetCandidate(const Candidate& aCandidate) const;

	UInt32 Value(UInt32 nValue) const;

	friend class Block;
	friend class BlockSet;
	friend class Board;
protected:
	const UInt32 nIndex_;

	mutable UInt32 nValue_;
	mutable Candidate aCandidate_;
};

}	// ATSudokuEngine
#endif
